package com.example.filedemo;

import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;

import java.util.Map;

public class SaveQQ extends AppCompatActivity {
    // 关联界面UI
    EditText et_account, et_password;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_save_q_q);
        et_account = findViewById(R.id.et_account);
        et_password = findViewById(R.id.et_password);
        getUserInfo();
    }

    private void getUserInfo() {

    }

    public void save(View view) {
        String account = et_account.getText().toString();
        String password = et_password.getText().toString();
        // 1 sp
        SharedPreferences sp = getSharedPreferences("data", MODE_PRIVATE);
        // 2 edit
        SharedPreferences.Editor edit = sp.edit();
        // 3 put
        edit.putString("account",account);
        edit.putString("password",password);
        // 4 commit
        edit.commit();
    }
}